package com.taoyeshu.modules.sys.controller;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taoyeshu.common.utils.PageResult;
import com.taoyeshu.modules.sys.entity.Log;
import com.taoyeshu.modules.sys.query.LogQuery;
import com.taoyeshu.modules.sys.service.LogService;

/**
 * 
 * @描述:首页
 * @作者 :HuanGe
 * @创建日期 :2015年9月28日 上午10:59:06
 *
 */
@Controller
@RequestMapping("/sys/log/")
public class LogController {

	@Autowired
	LogService logService;

	@RequestMapping("list")
	@RequiresPermissions("sys:log:view")
	public String list(Model model) {
		return "modules/sys/log/list";
	}

	@ResponseBody
	@RequestMapping("listData")
	@RequiresPermissions("sys:log:view")
	public PageResult<Log> listData(LogQuery logQuery) {
		logQuery.setType(0);
		PageResult<Log> result = logService.findPageResult(logQuery);
		return result;
	}

	@ResponseBody
	@RequestMapping("listExceptionData")
	@RequiresPermissions("sys:log:view")
	public PageResult<Log> listExceptionData(LogQuery logQuery) {
		logQuery.setType(1);
		PageResult<Log> result = logService.findPageResult(logQuery);
		return result;
	}

}
